"""
    案例：信用卡类的封装

"""

class CredictCard:
    """信用卡"""
    def __init__(self, name):
        self.name = name
        self.__balance = None
        self.__password = None

    @property
    def password(self):
        return self.__password

    @password.setter
    def password(self, password):
        if password != '88888888':
            print("密码输入错误")
        else:
            print("密码输入正确")
            self.__password = password
    @property
    def balance(self):
        return self.__balance

    @balance.setter
    def balance(self, balance):
        """消费后的剩余余额"""
        if self.__password != "88888888" or balance < 0:
            print("密码错误或者您的余额不足，请理性消费")
        else:
            self.__balance = balance
            print(f"消费成功，您的余额是:{self.__balance}")


zjj = CredictCard("张佳佳")
print(zjj.password)

zjj.password = "66666666"
# zjj.password = "88888888"

zjj.balance = 100